package Frame.battleanimation;

import FCRendering.FCRMaster;

import java.awt.*;

import static FCRendering.FCRMaster.fcv;

public class PutongAttackAni extends ABattleAni {


    private String name;

    private boolean canHit = true;//有没有打中

    /**
     * 还需要知道打了那个怪，让怪闪一闪动画表示被打了
     *
     * @param n
     */
    public PutongAttackAni(String n, boolean isPlayerAttackMode) {
        allFrames = 28;
        name = n;
        this.isPlayerAttackMode = isPlayerAttackMode;
        if (isPlayerAttackMode) {
            playerOffset[0] = (int) (20 * fcv.getProportion());
        } else {
            playerOffset[0] = (int) (40 * fcv.getProportion());
        }
    }

    public PutongAttackAni(String n, boolean isPlayerAttackMode, boolean canHit) {
        this(n, isPlayerAttackMode);
        this.canHit = canHit;
    }

    @Override
    public void nextFrame(int frame) {
        if (frame == 5) {
//            fcv.getMessage().add(
//                    FCRConstants.SYSTEM + FCRConstants.BATTLE + name + " " + FCRConstants.USE_TUSHOU);
//            fcv.setMessageShowNum(300);
        } else if (canHit) {
            //被打的那个闪2下就行了,就是 关，开，关，开
            if (frame < allFrames / 4) {
                beHitShowVisable = false;
            } else if (frame < allFrames / 2) {
                beHitShowVisable = true;
            } else if (frame < 3 * allFrames / 4) {
                beHitShowVisable = false;
            } else {
                beHitShowVisable = true;
            }
        }
    }

    @Override
    public void paintBattleSceen(Graphics g, FCRMaster fcrMaster) {

    }
}
